package cn.stylefeng.guns.generator.engine.config;

import cn.stylefeng.guns.generator.executor.config.GunsGeneratorConfig;
import lombok.Data;

@Data
public class PageConfig {

    private String pagePathTemplate;
    private String pageAddPathTemplate;
    private String pageEditPathTemplate;
    private String pageJsPathTemplate;
    private String pageEditJsPathTemplate;
    private String pageAddJsPathTemplate;
    private String  pageDetailPathTemplate;
    private String  pageDetailJSPathTemplate;
    public PageConfig(GunsGeneratorConfig gunsGeneratorConfig) {
        String modelName = gunsGeneratorConfig.getContextConfig().getModuleName();
        pagePathTemplate = "/src/main/webapp/pages/modular/" +modelName + "/{}/{}.html";
        pageAddPathTemplate = "/src/main/webapp/pages/modular/" + modelName+ "/{}/{}_add.html";
        pageEditPathTemplate = "/src/main/webapp/pages/modular/" + modelName + "/{}/{}_edit.html";
        pageDetailPathTemplate = "/src/main/webapp/pages/modular/" + modelName+ "/{}/{}_detail.html";
        pageJsPathTemplate = "/src/main/webapp/assets/modular/" + modelName + "/{}/{}.js";
        pageEditJsPathTemplate = "/src/main/webapp/assets/modular/" +modelName + "/{}/{}_edit.js";
        pageAddJsPathTemplate = "/src/main/webapp/assets/modular/" +modelName + "/{}/{}_add.js";
        pageDetailJSPathTemplate = "/src/main/webapp/assets/modular/" +modelName + "/{}/{}_detail.js";
    }
}
